#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include "words.h"
#include "loadfrommerriam.h"

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    /*LoadFromMerriam load_word;
    load_word.LoadFormTxt();
    load_word.show();
*/


    Words word;
    //word.processXML();



    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
    viewer.setMainQmlFile(QLatin1String("qml/Dictionary/main.qml"));
    QObject* rootObject = (QObject*)viewer.rootObject();
    QObject* btn_search = rootObject->findChild<QObject*>(QString("btn_search"));

    //QObject::connect(btn_search, SIGNAL(searchWord(QString)), &word, SLOT(searchWord(QString)));
    QObject::connect(btn_search, SIGNAL(searchWord(QString)), &word, SLOT(searchOnWeb(QString)));
    QObject::connect(&word, SIGNAL(updateTranslation(QVariant)), btn_search, SLOT(updateTranslation(QVariant)));
    viewer.showExpanded();

    return app->exec();
}
